package LeetCode.exercise;

import java.util.Arrays;

public class LC_283 {
    public static void main(String[] args) {
        int[] arr = {0,1,0,3,12};
        System.out.println(Arrays.toString(moveZeroes(arr)));
    }
    public static int[] moveZeroes(int[] nums) {
        for(int i = 0,j = -1; i < nums.length; i++){
            if(nums[i] != 0){
                j++;
                int temp = nums[i];
                nums[i] = nums[j];
                nums[j] = temp;
            }
        }
        return nums;
    }
}
